var ECharts;
$(document).ready(function () {

    require.config({
        baseUrl: ctx + '/resource/plugins/echarts4',
        paths: {
            echarts: 'echarts',
            roma: 'theme/roma',
        }
    });
    require(
        [
            'echarts',
            'roma'
        ],
        function (ec) {
            ECharts = ec;
            cpu_echart = ECharts.init(document.getElementById('cpu_echart'), 'roma');//cup仪表盘
            queryCpuState();
            memory_echart = ECharts.init(document.getElementById('memory_echart'), 'roma');//内存仪表盘
            queryMemoryState();
            snmp_echart = ECharts.init(document.getElementById('snmp_echart'), 'roma');//snmp仪表盘
            querySNMPState();
            cpu_h = ECharts.init(document.getElementById('cpu_h'), 'roma');//cpu折线图
            contrastCPU();
            cpu_num = ECharts.init(document.getElementById('cpu_num'), 'roma');//cpu柱状图
            queryCPUNum();
            memory_h = ECharts.init(document.getElementById('memory_h'), 'roma');//内存折线图
            contrastMemory();
            memory_num = ECharts.init(document.getElementById('memory_num'), 'roma');//内存柱状图
            queryMemoryNum();
            put_h = ECharts.init(document.getElementById('put_h'), 'roma');//吞吐率折线图
            contrastPut();
            put_num = ECharts.init(document.getElementById('put_num'), 'roma');//吞吐率柱状图
            queryPutNum();
        }
    );
    // ifConfig();//接口信息
    queryPoolInfor();//pool信息
    queryBasicInfo();//基本信息
});


var jkList = [];//接口
jkList.push("PM-00-01-900-01");//I/O速率
jkList.push("PM-00-02-001-05");//端口丢包率
jkList.push("PM-00-04-099-05");//端口状态
var poolList = [];//pool
poolList.push("FM-00-02-002-13");
poolList.push("PM-00-02-002-11");
poolList.push("PM-00-02-002-12");
poolList.push("PM-00-02-002-13");
poolList.push("PM-00-02-002-14");
poolList.push("PM-00-02-002-15");
poolList.push("PM-00-02-002-16");
poolList.push("PM-00-02-002-17");
poolList.push("PM-00-02-002-18");

var infoList = [];
infoList.push("CM-00-02-001-03");
infoList.push("CM-01-03-001-02");
infoList.push("CM-00-02-001-04");
// infoList.push("CM-00-01-001-22");

//cpu仪表盘
function queryCpuState() {
    // alert(EXT_UNIT_ID);
    $.ajax({
        url: ctx + "/load/queryNum",
        type: "post",
        data: "EXT_UNIT_ID=" + EXT_UNIT_ID + "&KPI_CODE=" + "PM-00-01-001-05" + "&DATE_TYPE=" + DATE_TYPE,
        success: function (data) {
            var cpuState = JSON.parse(data);
            var mydata;
            for (var i = 0; i < cpuState.length; i++) {
                var a = cpuState[i].AVG_VALUE;
            }
            option = {
                tooltip: {
                    formatter: "{a} <br/>{b} : {c}%"
                },
                toolbox: {
                    show: true,
                    feature: {
                        mark: {show: true},
                        // restore: {show: true},
                        // saveAsImage: {show: true}
                    }
                },
                series: [
                    {
                        name: '',
                        type: 'gauge',
                        splitNumber: 10,       // 分割段数，默认为5
                        axisLine: {            // 坐标轴线
                            lineStyle: {       // 属性lineStyle控制线条样式
                                color: [[0.2, '#228b22'], [0.8, '#48b'], [1, '#ff4500']],
                                width: 8
                            }
                        },
                        axisTick: {            // 坐标轴小标记
                            splitNumber: 10,   // 每份split细分多少段
                            length: 12,        // 属性length控制线长
                            lineStyle: {       // 属性lineStyle控制线条样式
                                color: 'auto'
                            }
                        },
                        axisLabel: {           // 坐标轴文本标签，详见axis.axisLabel
                            textStyle: {       // 其余属性默认使用全局文本样式，详见TEXTSTYLE
                                color: 'auto'
                            }
                        },
                        splitLine: {           // 分隔线
                            show: true,        // 默认显示，属性show控制显示与否
                            length: 30,         // 属性length控制线长
                            lineStyle: {       // 属性lineStyle（详见lineStyle）控制线条样式
                                color: 'auto'
                            }
                        },
                        pointer: {
                            width: 5
                        },
                        title: {
                            show: true,
                            offsetCenter: [0, '-40%'],       // x, y，单位px
                            textStyle: {       // 其余属性默认使用全局文本样式，详见TEXTSTYLE
                                fontWeight: 'bolder'
                            }
                        },
                        detail: {
                            formatter: '{value}%',
                            textStyle: {       // 其余属性默认使用全局文本样式，详见TEXTSTYLE
                                color: 'auto',
                                fontWeight: 'bolder'
                            }
                        },
                        data: []
                    }
                ]
            };//仪表盘结束
            var cpuName = "";
            var succ = [];
            var sun = [];
            var p_value = 0;
            var q_value = 0;
            var succs = 0;
            var sums = 0;
            if (DATE_TYPE == "showYear") {
                for (var j = 0; j < cpuState.length; j++) {
                    p_value = parseInt(cpuState[j].AVG_VALUE);
                    succ.push(p_value);
                    cpuName = cpuState[j].KPI_NAME;
                }
                for (var k = 0; k < succ.length; k++) {
                    succs += succ[k];
                }
                // alert(succs);
                mydata = [{value: parseInt(succs / cpuState.length), name: cpuName}];
            } else {
                for (var i = 0; i < cpuState.length; i++) {
                    mydata = [{value: cpuState[i].AVG_VALUE, name: cpuState[i].KPI_NAME}];

                }
            }

            if (a == undefined) {
                var table = "<h3 style='margin-top: 180px;padding-left: 140px;'>" + "暂无数据" + "</h3>";
                $("#cpu_echart").html(table);
            } else {
                option.series[0].data = mydata;
                cpu_echart.setOption(option);
            }
        }, error: function (textStatus) {
            console.log("error:" + textStatus.status);
        }
    });

}

//内存仪表盘
function queryMemoryState() {
    $.ajax({
        url: ctx + "/load/queryNum",
        type: "post",
        data: "EXT_UNIT_ID=" + EXT_UNIT_ID + "&KPI_CODE=" + "PM-00-01-002-01" + "&DATE_TYPE=" + DATE_TYPE,
        success: function (data) {
            var memoryState = JSON.parse(data);
            var mydata;
            for (var i = 0; i < memoryState.length; i++) {
                var a = memoryState[i].AVG_VALUE;
            }
            option = {
                tooltip: {
                    formatter: "{a} <br/>{b} : {c}%"
                },
                toolbox: {
                    show: true,
                    feature: {
                        mark: {show: true},
                        // restore: {show: true},
                        // saveAsImage: {show: true}
                    }
                },
                series: [
                    {
                        name: '',
                        type: 'gauge',
                        splitNumber: 10,       // 分割段数，默认为5
                        axisLine: {            // 坐标轴线
                            lineStyle: {       // 属性lineStyle控制线条样式
                                color: [[0.2, '#228b22'], [0.8, '#48b'], [1, '#ff4500']],
                                width: 8
                            }
                        },
                        axisTick: {            // 坐标轴小标记
                            splitNumber: 10,   // 每份split细分多少段
                            length: 12,        // 属性length控制线长
                            lineStyle: {       // 属性lineStyle控制线条样式
                                color: 'auto'
                            }
                        },
                        axisLabel: {           // 坐标轴文本标签，详见axis.axisLabel
                            textStyle: {       // 其余属性默认使用全局文本样式，详见TEXTSTYLE
                                color: 'auto'
                            }
                        },
                        splitLine: {           // 分隔线
                            show: true,        // 默认显示，属性show控制显示与否
                            length: 30,         // 属性length控制线长
                            lineStyle: {       // 属性lineStyle（详见lineStyle）控制线条样式
                                color: 'auto'
                            }
                        },
                        pointer: {
                            width: 5
                        },
                        title: {
                            show: true,
                            offsetCenter: [0, '-40%'],       // x, y，单位px
                            textStyle: {       // 其余属性默认使用全局文本样式，详见TEXTSTYLE
                                fontWeight: 'bolder'
                            }
                        },
                        detail: {
                            formatter: '{value}%',
                            textStyle: {       // 其余属性默认使用全局文本样式，详见TEXTSTYLE
                                color: 'auto',
                                fontWeight: 'bolder'
                            }
                        },
                        data: []
                    }
                ]
            };//仪表盘结束
            var memoryName = "";
            var succ = [];
            var sun = [];
            var p_value = 0;
            var q_value = 0;
            var succs = 0;
            var sums = 0;
            if (DATE_TYPE == "showYear") {
                for (var j = 0; j < memoryState.length; j++) {
                    p_value = parseInt(memoryState[j].AVG_VALUE);
                    succ.push(p_value);
                    memoryName = memoryState[j].KPI_NAME;
                }
                for (var k = 0; k < succ.length; k++) {
                    succs += succ[k];
                }
                mydata = [{value: parseInt(succs / memoryState.length), name: memoryName}];
            } else {
                for (var i = 0; i < memoryState.length; i++) {
                    mydata = [{value: memoryState[i].AVG_VALUE, name: memoryState[i].KPI_NAME}];
                }
            }

            if (a == undefined) {
                var table = "<h3 style='margin-top: 180px;padding-left: 140px;'>" + "暂无数据" + "</h3>";
                $("#memory_echart").html(table);
            } else {
                option.series[0].data = mydata;
                memory_echart.setOption(option);
            }
        }, error: function (textStatus) {
            console.log("error:" + textStatus.status);
        }
    });
}

//SNMP仪表盘
function querySNMPState() {
    $.ajax({
        url: ctx + "/load/queryNum",
        type: "post",
        data: "EXT_UNIT_ID=" + EXT_UNIT_ID + "&KPI_CODE=" + "FM-00-02-003-01" + "&DATE_TYPE=" + DATE_TYPE,
        success: function (data) {
            var SNMPState = JSON.parse(data);
            var mydata;
            for (var i = 0; i < SNMPState.length; i++) {
                var a = SNMPState[i].SUCCESS_VALUE;
                var b = SNMPState[i].COUNT_VALUE;
            }
            option = {
                tooltip: {
                    formatter: "{a} <br/>{b} : {c}%"
                },
                toolbox: {
                    show: true,
                    feature: {
                        mark: {show: true},
                        // restore: {show: true},
                        // saveAsImage: {show: true}
                    }
                },
                series: [
                    {
                        name: '',
                        type: 'gauge',
                        splitNumber: 10,       // 分割段数，默认为5
                        axisLine: {            // 坐标轴线
                            lineStyle: {       // 属性lineStyle控制线条样式
                                color: [[0.2, '#ff4500'], [0.8, '#48b'], [1, '#228b22']],//
                                width: 8
                            }
                        },
                        axisTick: {            // 坐标轴小标记
                            splitNumber: 10,   // 每份split细分多少段
                            length: 12,        // 属性length控制线长
                            lineStyle: {       // 属性lineStyle控制线条样式
                                color: 'auto'
                            }
                        },
                        axisLabel: {           // 坐标轴文本标签，详见axis.axisLabel
                            textStyle: {       // 其余属性默认使用全局文本样式，详见TEXTSTYLE
                                color: 'auto'
                            }
                        },
                        splitLine: {           // 分隔线
                            show: true,        // 默认显示，属性show控制显示与否
                            length: 30,         // 属性length控制线长
                            lineStyle: {       // 属性lineStyle（详见lineStyle）控制线条样式
                                color: 'auto'
                            }
                        },
                        pointer: {
                            width: 5
                        },
                        title: {
                            show: true,
                            offsetCenter: [0, '-40%'],       // x, y，单位px
                            textStyle: {       // 其余属性默认使用全局文本样式，详见TEXTSTYLE
                                fontWeight: 'bolder'
                            }
                        },
                        detail: {
                            formatter: '{value}%',
                            textStyle: {       // 其余属性默认使用全局文本样式，详见TEXTSTYLE
                                color: 'auto',
                                fontWeight: 'bolder'
                            }
                        },
                        data: []
                    }
                ]
            };//仪表盘结束
            var SNMPName = "";
            var succ = [];
            var sun = [];
            var p_value = 0;
            var q_value = 0;
            var succs = 0;
            var sums = 0;
            if (DATE_TYPE == "showYear") {
                for (var j = 0; j < SNMPState.length; j++) {
                    p_value = parseInt(SNMPState[j].SUCCESS_VALUE);
                    succ.push(p_value);
                    q_value = parseInt(SNMPState[j].COUNT_VALUE);
                    sun.push(q_value);
                    SNMPName = SNMPState[j].KPI_NAME;
                }
                for (var k = 0; k < succ.length; k++) {
                    succs += succ[k];
                    sums += sun[k];
                }
                mydata = [{value: parseInt(succs / sums * 100), name: SNMPName}];
            } else {
                for (var i = 0; i < SNMPState.length; i++) {
                    mydata = [{
                        value: parseInt(SNMPState[i].SUCCESS_VALUE / SNMPState[i].COUNT_VALUE * 100),
                        name: SNMPState[i].KPI_NAME
                    }];
                }
            }

            if (a == undefined || b == undefined) {
                var table = "<h3 style='margin-top: 180px;padding-left: 140px;'>" + "暂无数据" + "</h3>";
                $("#snmp_echart").html(table);
            } else {
                option.series[0].data = mydata;
                snmp_echart.setOption(option);
            }
        }, error: function (textStatus) {
            console.log("error:" + textStatus.status);
        }
    });
}

//cpu折线图
function contrastCPU() {
    $.ajax({
        url: ctx + "/load/queryLoad",
        type: "post",
        data: "EXT_UNIT_ID=" + EXT_UNIT_ID + "&KPI_CODE=" + "PM-00-01-001-05" + "&DATE_TYPE=" + DATE_TYPE,
        success: function (data) {
            var map = JSON.parse(data);
            var list = map.list;
            var listTb = map.listTb;
            var listHb = map.listHb;
            var xdata = [];
            var ydata1 = [];
            var ydata2 = [];
            var ydata3 = [];
            var x_value = [];
            for (var i = 0; i < list.length; i++) {
                var a = list[i].AVG_VALUE;
                var b = listTb[i].AVG_VALUE;
                // var c = listHb[i].AVG_VALUE;
            }
            if (a == undefined || b == undefined) {
                var table = "<h3 style='margin-top: 200px;padding-left: 340px;'>" + "暂无数据" + "</h3>";
                $("#cpu_h").html(table);
            } else {
                if (DATE_TYPE == "showWeek") {
                    for (var i = 0; i < list.length; i++) {
                        x_value = list[i].DATA_TIME.split("-");
                        xdata.push(x_value[2]);
                        ydata1.push(list[i].AVG_VALUE);
                        ydata2.push(listTb[i].AVG_VALUE);
                        ydata3.push(listHb[i].AVG_VALUE);
                    }
                } else if (DATE_TYPE == "showMonth") {
                    for (var i = 0; i < list.length; i++) {
                        x_value = list[i].DATA_TIME.split("-");
                        xdata.push(x_value[2]);
                        ydata1.push(list[i].AVG_VALUE);
                        ydata2.push(listTb[i].AVG_VALUE);
                        ydata3.push(listHb[i].AVG_VALUE);
                    }
                } else if (DATE_TYPE == "showYear") {
                    for (var i = 0; i < list.length; i++) {
                        // xdata.push(list[i].DATA_TIME);
                        x_value = list[i].DATA_TIME.split("-");
                        xdata.push(x_value[1]);
                        ydata1.push(list[i].AVG_VALUE);
                        ydata2.push(listTb[i].AVG_VALUE);
                        /*ydata3.push(listHb[i].AVG_VALUE);*/
                    }
                } else {
                    for (var i = 0; i < list.length; i++) {
                        x_value = list[i].DATA_TIME.replace(' ', '-').split("-");
                        xdata.push(x_value[3]);
                        ydata1.push(list[i].AVG_VALUE);
                        ydata2.push(listTb[i].AVG_VALUE);
                        ydata3.push(listHb[i].AVG_VALUE);
                    }
                }
                option = {
                    tooltip: {
                        trigger: 'axis',
                    },
                    legend: {
                        data: ['昨日', '同比', '环比'],
                        textStyle: {
                            color: '#AAAAAA'
                        }
                    },
                    grid: {
                        left: '3%',
                        right: '4%',
                        bottom: '3%',
                        containLabel: true
                    },
                    xAxis: [{
                        type: 'category',
                        boundaryGap: false,
                        axisLabel: {
                            /*formatter:'{value} h',*/
                            textStyle: {
                                color: '#AAAAAA'
                            }
                        },
                        data: xdata
                    }],
                    yAxis: [{
                        type: 'value',
                        max: 100,//Y轴最大值 不写的话自动调节
                        axisLabel: {
                            formatter: '{value} %',
                            textStyle: {
                                color: '#AAAAAA'
                            }
                        }
                    }],
                    series: [
                        {
                            name: '昨日',
                            type: 'line',
                            color: '#EFB700',
                            data: ydata1
                        },
                        {
                            name: '同比',
                            type: 'line',
                            color: '#FF0A0E',
                            data: ydata2
                        },
                        {
                            name: '环比',
                            type: 'line',
                            color: '#0AFFBD',
                            data: ydata3
                        }
                    ]
                };
                cpu_h.setOption(option);
            }
        }, error: function (textStatus) {
            console.log("error:" + textStatus.status);
        }
    });
}

//内存折线图
function contrastMemory() {
    $.ajax({
        url: ctx + "/load/queryLoad",
        type: 'post',
        data: "EXT_UNIT_ID=" + EXT_UNIT_ID + "&KPI_CODE=" + "PM-00-01-002-01" + "&DATE_TYPE=" + DATE_TYPE,
        success: function (data) {
            var map = JSON.parse(data);
            var list = map.list;
            var listTb = map.listTb;
            var listHb = map.listHb;
            var xdata = [];
            var ydata1 = [];
            var ydata2 = [];
            var ydata3 = [];
            var x_value = [];
            for (var i = 0; i < list.length; i++) {
                var a = list[i].AVG_VALUE;
                var b = listTb[i].AVG_VALUE;
                // var c = listHb[i].AVG_VALUE;
            }
            if (a == undefined || b == undefined) {
                var table = "<h3 style='margin-top: 200px;padding-left: 340px;'>" + "暂无数据" + "</h3>";
                $("#memory_h").html(table);
            } else {
                if (DATE_TYPE == "showWeek") {
                    for (var i = 0; i < list.length; i++) {
                        x_value = list[i].DATA_TIME.split("-");
                        xdata.push(x_value[2]);
                        ydata1.push(list[i].AVG_VALUE);
                        ydata2.push(listTb[i].AVG_VALUE);
                        ydata3.push(listHb[i].AVG_VALUE);
                    }
                } else if (DATE_TYPE == "showMonth") {
                    for (var i = 0; i < list.length; i++) {
                        x_value = list[i].DATA_TIME.split("-");
                        xdata.push(x_value[2]);
                        ydata1.push(list[i].AVG_VALUE);
                        ydata2.push(listTb[i].AVG_VALUE);
                        ydata3.push(listHb[i].AVG_VALUE);
                    }
                } else if (DATE_TYPE == "showYear") {
                    for (var i = 0; i < list.length; i++) {
                        // xdata.push(list[i].DATA_TIME);
                        x_value = list[i].DATA_TIME.split("-");
                        xdata.push(x_value[1]);
                        ydata1.push(list[i].AVG_VALUE);
                        ydata2.push(listTb[i].AVG_VALUE);
                        /*ydata3.push(listHb[i].AVG_VALUE);*/
                    }
                } else {
                    for (var i = 0; i < list.length; i++) {
                        x_value = list[i].DATA_TIME.replace(' ', '-').split("-");
                        xdata.push(x_value[3]);
                        ydata1.push(list[i].AVG_VALUE);
                        ydata2.push(listTb[i].AVG_VALUE);
                        ydata3.push(listHb[i].AVG_VALUE);
                    }
                }
                option = {
                    tooltip: {
                        trigger: 'axis',
                    },
                    legend: {
                        data: ['昨日', '同比', '环比'],
                        textStyle: {
                            color: '#AAAAAA'
                        }
                    },
                    grid: {
                        left: '3%',
                        right: '4%',
                        bottom: '3%',
                        containLabel: true
                    },
                    xAxis: [{
                        type: 'category',
                        boundaryGap: false,
                        axisLabel: {
                            /* formatter: '{value} h',*/
                            textStyle: {
                                color: '#AAAAAA'
                            }
                        },
                        data: xdata
                    }],
                    yAxis: [{
                        type: 'value',
                        max: 100,//Y轴最大值 不写的话自动调节
                        axisLabel: {
                            formatter: '{value} %',
                            textStyle: {
                                color: '#AAAAAA'
                            }
                        }
                    }],
                    series: [
                        {
                            name: '昨日',
                            type: 'line',
                            color: '#EFB700',
                            data: ydata1
                        },
                        {
                            name: '同比',
                            type: 'line',
                            color: '#FF0A0E',
                            data: ydata2
                        },
                        {
                            name: '环比',
                            type: 'line',
                            color: '#0AFFBD',
                            data: ydata3
                        }
                    ]
                };
                memory_h.setOption(option);
            }
        }, error: function (textStatus) {
            console.log("error:" + textStatus.status);
        }
    });

}

//吞吐率折线图
function contrastPut() {
    $.ajax({
        url: ctx + "/load/queryLoad",
        type: 'post',
        data: "EXT_UNIT_ID=" + EXT_UNIT_ID + "&KPI_CODE=" + "PM-00-05-009-31" + "&DATE_TYPE=" + DATE_TYPE,
        success: function (data) {
            var map = JSON.parse(data);
            var list = map.list;
            var listTb = map.listTb;
            var listHb = map.listHb;
            var xdata = [];
            var ydata1 = [];
            var ydata2 = [];
            var ydata3 = [];
            var x_value = [];
            for (var i = 0; i < list.length; i++) {
                var a = list[i].AVG_VALUE;
                var b = listTb[i].AVG_VALUE;
                // var c = listHb[i].AVG_VALUE;
            }
            if (a == undefined || b == undefined) {
                var table = "<h3 style='margin-top: 200px;padding-left: 340px;'>" + "暂无数据" + "</h3>";
                $("#put_h").html(table);
            } else {
                if (DATE_TYPE == "showWeek") {
                    for (var i = 0; i < list.length; i++) {
                        x_value = list[i].DATA_TIME.split("-");
                        xdata.push(x_value[2]);
                        ydata1.push(list[i].AVG_VALUE);
                        ydata2.push(listTb[i].AVG_VALUE);
                        ydata3.push(listHb[i].AVG_VALUE);
                    }
                } else if (DATE_TYPE == "showMonth") {
                    for (var i = 0; i < list.length; i++) {
                        x_value = list[i].DATA_TIME.split("-");
                        xdata.push(x_value[2]);
                        ydata1.push(list[i].AVG_VALUE);
                        ydata2.push(listTb[i].AVG_VALUE);
                        ydata3.push(listHb[i].AVG_VALUE);
                    }
                } else if (DATE_TYPE == "showYear") {
                    for (var i = 0; i < list.length; i++) {
                        x_value = list[i].DATA_TIME.split("-");
                        xdata.push(x_value[1]);
                        // xdata.push(list[i].DATA_TIME);
                        ydata1.push(list[i].AVG_VALUE);
                        ydata2.push(listTb[i].AVG_VALUE);
                        /*ydata3.push(listHb[i].AVG_VALUE);*/
                    }
                } else {
                    for (var i = 0; i < list.length; i++) {
                        x_value = list[i].DATA_TIME.replace(' ', '-').split("-");
                        xdata.push(x_value[3]);
                        ydata1.push(list[i].AVG_VALUE);
                        ydata2.push(listTb[i].AVG_VALUE);
                        ydata3.push(listHb[i].AVG_VALUE);
                    }
                }
                option = {
                    tooltip: {
                        trigger: 'axis',
                    },
                    legend: {
                        data: ['昨日', '同比', '环比'],
                        textStyle: {
                            color: '#AAAAAA'
                        }
                    },
                    grid: {
                        left: '3%',
                        right: '4%',
                        bottom: '3%',
                        containLabel: true
                    },
                    xAxis: {
                        type: 'category',
                        boundaryGap: false,
                        axisLabel: {
                            /*formatter: '{value} h',*/
                            textStyle: {
                                color: '#AAAAAA'
                            }
                        },
                        data: xdata
                    },
                    yAxis: {
                        type: 'value',
                        max: 100,
                        axisLabel: {
                            formatter: '{value} %',
                            textStyle: {
                                color: '#AAAAAA'
                            }
                        }
                    },
                    series: [
                        {
                            name: '昨日',
                            type: 'line',
                            color: '#EFB700',
                            data: ydata1
                        },
                        {
                            name: '同比',
                            type: 'line',
                            color: '#FF0A0E',
                            data: ydata2
                        },
                        {
                            name: '环比',
                            type: 'line',
                            color: '#0AFFBD',
                            data: ydata3
                        }

                    ]
                };
                put_h.setOption(option);
            }
        }, error: function (textStatus) {
            console.log("error:" + textStatus.status);
        }
    });

}

//cpu柱状图
function queryCPUNum() {
    $.ajax({
        url: ctx + "/load/queryNum",
        type: "post",
        data: "DATE_TYPE=" + DATE_TYPE + "&EXT_UNIT_ID=" + EXT_UNIT_ID + "&KPI_CODE=" + "PM-00-01-001-05",
        success: function (data) {
            var memoryNum = JSON.parse(data);
            var xdata = [];
            var num1 = '';
            var min_value = '';
            var max_value = '';
            var group = '';
            var p = [];
            var values = [];
            var result = [0, 0, 0, 0, 0];
            var temp = '';
            var temp1 = '';
            var hkh = '';
            var myMap = new Map();
            var sum = 0;
            for (var i = 0; i < memoryNum.length; i++) {
                var a = memoryNum[i].GROUP_VALUE;
            }
            if (a == undefined) {
                var table = "<h3 style='margin-top: 200px;padding-left: 340px;'>" + "暂无数据" + "</h3>";
                $("#cpu_num").html(table);
            } else {
                if (DATE_TYPE != "showYear") {//，分割分完的截取每个元素的倒数第一个或者第二个双引号的值{"0.0~20.0":"289"，"20.0~40.0":"290，"40.0~60.0":"291"}
                    for (var i = 0; i < memoryNum.length; i++) {
                        hkh = memoryNum[i].GROUP_VALUE.substring(1, memoryNum[i].GROUP_VALUE.lastIndexOf('}'));
                        num1 = hkh.split(',');
                        min_value = memoryNum[i].Y_MIN_VALUE;
                        max_value = memoryNum[i].Y_MAX_VALUE;
                        group = memoryNum[i].VALUE_GROUP;
                        for (j = 0; j < num1.length; j++) {
                            temp = num1[j].substring(num1[j].lastIndexOf(':"') + 2, num1[j].lastIndexOf('"'));
                            temp1 = num1[j].substring(1, num1[j].lastIndexOf('":'));
                            myMap.set(temp1, temp);
                        }
                        if (myMap.get("0.0~20.0") != null) {
                            xdata.push(myMap.get("0.0~20.0"));
                        } else {
                            xdata.push(0);
                        }
                        if (myMap.get("20.0~40.0") != null) {
                            xdata.push(myMap.get("20.0~40.0"));
                        } else {
                            xdata.push(0);
                        }
                        if (myMap.get("40.0~60.0") != null) {
                            xdata.push(myMap.get("40.0~60.0"));
                        } else {
                            xdata.push(0);
                        }
                        if (myMap.get("60.0~80.0") != null) {
                            xdata.push(myMap.get("60.0~80.0"));
                        } else {
                            xdata.push(0);
                        }
                        if (myMap.get("80.0~100.0") != null) {
                            xdata.push(myMap.get("80.0~100.0"));
                        } else {
                            xdata.push(0);
                        }
                    }
                } else {
                    for (var i = 0; i < memoryNum.length; i++) {
                        hkh = memoryNum[i].GROUP_VALUE.substring(1, memoryNum[i].GROUP_VALUE.lastIndexOf('}'));
                        num1 = hkh.split(',');
                        min_value = memoryNum[i].Y_MIN_VALUE;
                        max_value = memoryNum[i].Y_MAX_VALUE;
                        group = memoryNum[i].VALUE_GROUP;
                        for (var j = 0; j < num1.length; j++) {
                            temp = num1[j].substring(num1[j].lastIndexOf(':"') + 2, num1[j].lastIndexOf('"'));
                            temp1 = num1[j].substring(1, num1[j].lastIndexOf('":'));
                            if(temp){
                                sum = parseInt(sum) + parseInt(temp);
                            }
                            myMap.set(temp1, sum);
                        }
                    }
                    if (myMap.get("0.0~20.0") != null) {
                        xdata.push(myMap.get("0.0~20.0"));
                    } else {
                        xdata.push(0);
                    }
                    if (myMap.get("20.0~40.0") != null) {
                        xdata.push(myMap.get("20.0~40.0"));
                    } else {
                        xdata.push(0);
                    }
                    if (myMap.get("40.0~60.0") != null) {
                        xdata.push(myMap.get("40.0~60.0"));
                    } else {
                        xdata.push(0);
                    }
                    if (myMap.get("60.0~80.0") != null) {
                        xdata.push(myMap.get("60.0~80.0"));
                    } else {
                        xdata.push(0);
                    }
                    if (myMap.get("80.0~100.0") != null) {
                        xdata.push(myMap.get("80.0~100.0"));
                    } else {
                        xdata.push(0);
                    }
                }
                option = {
                    color: ['#23CBFE'],
                    title: {
                        text: '',
                        subtext: ''
                    },
                    tooltip: {
                        trigger: 'axis',
                        axisPointer: {
                            type: 'shadow'
                        }
                    },
                    legend: {
                        data: ['CPU使用率次数'],
                        textStyle: {
                            color: '#AAAAAA'
                        }
                    },
                    grid: {
                        left: '3%',
                        right: '4%',
                        bottom: '3%',
                        containLabel: true
                    },
                    xAxis: {
                        type: 'value',
                        boundaryGap: [0, 0.01],
                        splitLine: {
                            show: false
                        },
                        axisLabel: {
                            textStyle: {
                                color: '#AAAAAA'
                            }
                        }
                    },
                    yAxis: {
                        type: 'category',
                        splitLine: {
                            show: true
                        },
                        axisLabel: {
                            textStyle: {
                                color: '#AAAAAA'
                            }
                        },
                        data: [
                            (max_value - min_value) / group,
                            (max_value - min_value) / group * 2,
                            (max_value - min_value) / group * 3,
                            (max_value - min_value) / group * 4,
                            (max_value - min_value) / group * 5,
                        ]
                    },
                    series: [
                        {
                            name: 'CPU使用率次数',
                            type: 'bar',
                            barWidth: 30,
                            data: xdata
                        }
                    ]

                };
                cpu_num.setOption(option);
            }
        }, error: function (textStatus) {
            console.log("error:" + textStatus.status);
        }
    });
}

//内存柱状图
function queryMemoryNum() {
    $.ajax({
            url: ctx + "/load/queryNum",
            type: "post",
            data: "EXT_UNIT_ID=" + EXT_UNIT_ID + "&KPI_CODE=" + "PM-00-01-002-01" + "&DATE_TYPE=" + DATE_TYPE,
            success: function (data) {
                var memoryNum = JSON.parse(data);
                var xdata = [];
                var num1 = '';
                var min_value = '';
                var max_value = '';
                var group = '';
                var p = [];
                var values = [];
                var result = [0, 0, 0, 0, 0];
                var temp = '';
                var temp1 = '';
                var hkh = '';
                var myMap = new Map();
                var sum = 0;
                for (var i = 0; i < memoryNum.length; i++) {
                    var a = memoryNum[i].GROUP_VALUE;
                }
                if (a == undefined) {
                    var table = "<h3 style='margin-top: 200px;padding-left: 340px;'>" + "暂无数据" + "</h3>";
                    $("#memory_num").html(table);
                } else {
                    if (DATE_TYPE != "showYear") {//，分割分完的截取每个元素的倒数第一个或者第二个双引号的值{"0.0~20.0":"289"，"20.0~40.0":"290，"40.0~60.0":"291"}
                        for (var i = 0; i < memoryNum.length; i++) {
                            hkh = memoryNum[i].GROUP_VALUE.substring(1, memoryNum[i].GROUP_VALUE.lastIndexOf('}'));
                            num1 = hkh.split(',');
                            min_value = memoryNum[i].Y_MIN_VALUE;
                            max_value = memoryNum[i].Y_MAX_VALUE;
                            group = memoryNum[i].VALUE_GROUP;
                            for (var j = 0; j < num1.length; j++) {
                                temp = num1[j].substring(num1[j].lastIndexOf(':"') + 2, num1[j].lastIndexOf('"'));
                                temp1 = num1[j].substring(1, num1[j].lastIndexOf('":'));
                                myMap.set(temp1, temp);
                            }
                            if (myMap.get("0.0~20.0") != null) {
                                xdata.push(myMap.get("0.0~20.0"));
                            } else {
                                xdata.push(0);
                            }
                            if (myMap.get("20.0~40.0") != null) {
                                xdata.push(myMap.get("20.0~40.0"));
                            } else {
                                xdata.push(0);
                            }
                            if (myMap.get("40.0~60.0") != null) {
                                xdata.push(myMap.get("40.0~60.0"));
                            } else {
                                xdata.push(0);
                            }
                            if (myMap.get("60.0~80.0") != null) {
                                xdata.push(myMap.get("60.0~80.0"));
                            } else {
                                xdata.push(0);
                            }
                            if (myMap.get("80.0~100.0") != null) {
                                xdata.push(myMap.get("80.0~100.0"));
                            } else {
                                xdata.push(0);
                            }
                        }
                    } else {
                        for (var i = 0; i < memoryNum.length; i++) {
                            hkh = memoryNum[i].GROUP_VALUE.substring(1, memoryNum[i].GROUP_VALUE.lastIndexOf('}'));
                            num1 = hkh.split(',');
                            min_value = memoryNum[i].Y_MIN_VALUE;
                            max_value = memoryNum[i].Y_MAX_VALUE;
                            group = memoryNum[i].VALUE_GROUP;
                            for (var j = 0; j < num1.length; j++) {
                                temp = num1[j].substring(num1[j].lastIndexOf(':"') + 2, num1[j].lastIndexOf('"'));
                                temp1 = num1[j].substring(1, num1[j].lastIndexOf('":'));
                                if(temp){
                                    sum = parseInt(sum) + parseInt(temp);
                                }
                                myMap.set(temp1, sum);
                            }
                        }
                        if (myMap.get("0.0~20.0") != null) {
                            xdata.push(myMap.get("0.0~20.0"));
                        } else {
                            xdata.push(0);
                        }
                        if (myMap.get("20.0~40.0") != null) {
                            xdata.push(myMap.get("20.0~40.0"));
                        } else {
                            xdata.push(0);
                        }
                        if (myMap.get("40.0~60.0") != null) {
                            xdata.push(myMap.get("40.0~60.0"));
                        } else {
                            xdata.push(0);
                        }
                        if (myMap.get("60.0~80.0") != null) {
                            xdata.push(myMap.get("60.0~80.0"));
                        } else {
                            xdata.push(0);
                        }
                        if (myMap.get("80.0~100.0") != null) {
                            xdata.push(myMap.get("80.0~100.0"));
                        } else {
                            xdata.push(0);
                        }
                    }
                    option = {
                        color: ['#23CBFE'],
                        title: {
                            text: '',
                            subtext: ''
                        },
                        tooltip: {
                            trigger: 'axis',
                            axisPointer: {
                                type: 'shadow'
                            }
                        },
                        legend: {
                            data: ['内存使用率次数'],
                            textStyle: {
                                color: '#AAAAAA'
                            }
                        },
                        grid: {
                            left: '3%',
                            right: '4%',
                            bottom: '3%',
                            containLabel: true
                        },
                        xAxis: {
                            type: 'value',
                            boundaryGap: [0, 0.01],
                            axisLabel: {
                                textStyle: {
                                    color: '#AAAAAA'
                                }
                            },
                            splitLine: {
                                show: false
                            }
                        },
                        yAxis: {
                            type: 'category',
                            axisLabel: {
                                textStyle: {
                                    color: '#AAAAAA'
                                }
                            },
                            splitLine: {
                                show: true
                            },
                            data: [
                                (max_value - min_value) / group,
                                (max_value - min_value) / group * 2,
                                (max_value - min_value) / group * 3,
                                (max_value - min_value) / group * 4,
                                (max_value - min_value) / group * 5,
                            ]
                        },
                        series: [
                            {
                                name: '内存使用率次数',
                                type: 'bar',
                                barWidth: 30,
                                data: xdata
                            }
                        ]
                    };
                    memory_num.setOption(option);
                }
            }, error:
                function (textStatus) {
                    console.log("error:" + textStatus.status);
                }
        }
    )
    ;
}

//吞吐率柱状图
function queryPutNum() {
    $.ajax({
        url: ctx + "/load/queryNum",
        type: "post",
        data: "EXT_UNIT_ID=" + EXT_UNIT_ID + "&KPI_CODE=" + "PM-00-05-009-31" + "&DATE_TYPE=" + DATE_TYPE,
        success: function (data) {
            var memoryNum = JSON.parse(data);
            var xdata = [];
            var num1 = '';
            var min_value = '';
            var max_value = '';
            var group = '';
            var p = [];
            var values = [];
            var result = [0, 0, 0, 0, 0];
            var temp = '';
            var temp1 = '';
            var hkh = '';
            var myMap = new Map();
            var sum =0;
            for (var i = 0; i < memoryNum.length; i++) {
                var a = memoryNum[i].GROUP_VALUE;
            }
            if (a == undefined) {
                var table = "<h3 style='margin-top: 200px;padding-left: 340px;'>" + "暂无数据" + "</h3>";
                $("#put_num").html(table);
            } else {
                if (DATE_TYPE != "showYear") {//，分割分完的截取每个元素的倒数第一个或者第二个双引号的值{"0.0~20.0":"289"，"20.0~40.0":"290，"40.0~60.0":"291"}
                    for (var i = 0; i < memoryNum.length; i++) {
                        hkh = memoryNum[i].GROUP_VALUE.substring(1, memoryNum[i].GROUP_VALUE.lastIndexOf('}'));
                        num1 = hkh.split(',');
                        min_value = memoryNum[i].Y_MIN_VALUE;
                        max_value = memoryNum[i].Y_MAX_VALUE;
                        group = memoryNum[i].VALUE_GROUP;
                        for (j = 0; j < num1.length; j++) {
                            temp = num1[j].substring(num1[j].lastIndexOf(':"') + 2, num1[j].lastIndexOf('"'));
                            temp1 = num1[j].substring(1, num1[j].lastIndexOf('":'));
                            myMap.set(temp1, temp);
                        }
                        if (myMap.get("0.0~20.0") != null) {
                            xdata.push(myMap.get("0.0~20.0"));
                        } else {
                            xdata.push(0);
                        }
                        if (myMap.get("20.0~40.0") != null) {
                            xdata.push(myMap.get("20.0~40.0"));
                        } else {
                            xdata.push(0);
                        }
                        if (myMap.get("40.0~60.0") != null) {
                            xdata.push(myMap.get("40.0~60.0"));
                        } else {
                            xdata.push(0);
                        }
                        if (myMap.get("60.0~80.0") != null) {
                            xdata.push(myMap.get("60.0~80.0"));
                        } else {
                            xdata.push(0);
                        }
                        if (myMap.get("80.0~100.0") != null) {
                            xdata.push(myMap.get("80.0~100.0"));
                        } else {
                            xdata.push(0);
                        }
                    }
                } else {
                    for (var i = 0; i < memoryNum.length; i++) {
                        hkh = memoryNum[i].GROUP_VALUE.substring(1, memoryNum[i].GROUP_VALUE.lastIndexOf('}'));
                        num1 = hkh.split(',');
                        min_value = memoryNum[i].Y_MIN_VALUE;
                        max_value = memoryNum[i].Y_MAX_VALUE;
                        group = memoryNum[i].VALUE_GROUP;
                        for (var j = 0; j < num1.length; j++) {
                            temp = num1[j].substring(num1[j].lastIndexOf(':"') + 2, num1[j].lastIndexOf('"'));
                            temp1 = num1[j].substring(1, num1[j].lastIndexOf('":'));
                            if(temp){
                                sum = parseInt(sum) + parseInt(temp);
                            }
                            myMap.set(temp1, sum);
                        }
                    }
                    if (myMap.get("0.0~20.0") != null) {
                        xdata.push(myMap.get("0.0~20.0"));
                    } else {
                        xdata.push(0);
                    }
                    if (myMap.get("20.0~40.0") != null) {
                        xdata.push(myMap.get("20.0~40.0"));
                    } else {
                        xdata.push(0);
                    }
                    if (myMap.get("40.0~60.0") != null) {
                        xdata.push(myMap.get("40.0~60.0"));
                    } else {
                        xdata.push(0);
                    }
                    if (myMap.get("60.0~80.0") != null) {
                        xdata.push(myMap.get("60.0~80.0"));
                    } else {
                        xdata.push(0);
                    }
                    if (myMap.get("80.0~100.0") != null) {
                        xdata.push(myMap.get("80.0~100.0"));
                    } else {
                        xdata.push(0);
                    }
                }
                option = {
                    color: ['#23CBFE'],
                    title: {
                        text: '',
                        subtext: ''
                    },
                    tooltip: {
                        trigger: 'axis',
                        axisPointer: {
                            type: 'shadow'
                        }
                    },
                    legend: {
                        data: ['吞吐率次数'],
                        textStyle: {
                            color: '#AAAAAA'
                        }
                    },
                    grid: {
                        left: '3%',
                        right: '4%',
                        bottom: '3%',
                        containLabel: true
                    },
                    xAxis: {
                        type: 'value',
                        boundaryGap: [0, 0.01],
                        splitLine: {
                            show: false
                        },
                        axisLabel: {
                            textStyle: {
                                color: '#AAAAAA'
                            }
                        }
                    },
                    yAxis: {
                        type: 'category',
                        splitLine: {
                            show: true
                        },
                        axisLabel: {
                            textStyle: {
                                color: '#AAAAAA'
                            }
                        },
                        data: [
                            (max_value - min_value) / group,
                            (max_value - min_value) / group * 2,
                            (max_value - min_value) / group * 3,
                            (max_value - min_value) / group * 4,
                            (max_value - min_value) / group * 5,
                        ]
                    },
                    series: [
                        {
                            name: '吞吐率次数',
                            type: 'bar',
                            barWidth: 30,
                            data: xdata
                        }
                    ]
                };
                put_num.setOption(option);
            }
        }, error: function (textStatus) {
            console.log("error:" + textStatus.status);
        }
    });
}

//基本信息
function queryBasicInfo() {
    var str = infoList.toString();
    $.ajax({
        url: ctx + "/load/queryInfo",
        type: "post",
        data: "EXT_UNIT_ID=" + EXT_UNIT_ID + "&RESU=" + str,
        success: function (data) {
            var map = JSON.parse(data);
            // console.log(map);
            var list = map["CM-00-02-001-03"];
            var list1 = map["CM-01-03-001-02"];
            var list2 = map["CM-00-02-001-04"];
            // var list3 = map["CM-00-01-001-22"];
            var tablel = "";
            if (list.length == 0) {

            }
            // if (list1.length == 0) {
            //
            // }
            if (list2.length == 0) {

            } else {
                tablel += "<tr>" +
                    "<th><span >" + list[0].KPI_NAME + "</span></th>" +
                    // "<th><span >" + list1[0].KPI_NAME + "</span></th>" +
                    "<th><span >" + list2[0].KPI_NAME + "</span></th>" +
                    "</tr>";
                tablel += "<tr>" +
                    "<td><span >" + list[0].KPI_VALUE + "</span></td>" +
                    // "<td><span >" + list1[0].KPI_VALUE + "</span></td>" +
                    "<td><span >" + list2[0].KPI_VALUE + "</span></td>" +
                    "</tr>";
            }
            $("#info").append(tablel);
        }, error: function (textStatus) {
            console.log("error:" + textStatus.status);
        }
    });
}

//pool(连接池)信息
function queryPoolInfor() {
    var str = poolList.toString();
    $.ajax({
        url: ctx + "/load/queryTable",
        type: "post",
        data: "EXT_UNIT_ID=" + EXT_UNIT_ID + "&RESU=" + str + "&DATE_TYPE=" + DATE_TYPE,
        success: function (data) {
            var map = JSON.parse(data);
            var list1 = map["FM-00-02-002-13"];
            var list2 = map["PM-00-02-002-11"];
            var list3 = map["PM-00-02-002-12"];
            var list4 = map["PM-00-02-002-13"];
            var list5 = map["PM-00-02-002-14"];
            var list6 = map["PM-00-02-002-15"];
            var list7 = map["PM-00-02-002-16"];
            var list8 = map["PM-00-02-002-17"];
            // var list9 = map["PM-00-02-002-18"];
            var table = "";
            if (list1.length == 1 && list2.length == 1 && list3.length == 1 && list4.length == 1 && list5.length == 1 && list6.length == 1 && list7.length == 1 && list8.length == 1) {
                table += "<tr>" +
                    "<th><span >" + "pool名称" + "</span></th>" +
                    "<th><span >" + list1[0].KPI_NAME + "</span></th>" +
                    "<th><span >" + list2[0].KPI_NAME + "</span></th>" +
                    "<th><span >" + list3[0].KPI_NAME + "</span></th>" +
                    "<th><span >" + list4[0].KPI_NAME + "</span></th>" +
                    "<th><span >" + list5[0].KPI_NAME + "</span></th>" +
                    "<th><span >" + list6[0].KPI_NAME + "</span></th>" +
                    "<th><span >" + list7[0].KPI_NAME + "</span></th>" +
                    "<th><span >" + list8[0].KPI_NAME + "</span></th></tr>" +
                    "<tr><td><span >" + AvgList2[c] / iSameLine + "</span></td></tr>";
            } else {
                table += "<tr>" +
                    "<th><span >" + "pool名称" + "</span></th>" +
                    "<th><span >" + list1[0].KPI_NAME + "</span></th>" +
                    "<th><span >" + list2[0].KPI_NAME + "</span></th>" +
                    "<th><span >" + list3[0].KPI_NAME + "</span></th>" +
                    "<th><span >" + list4[0].KPI_NAME + "</span></th>" +
                    "<th><span >" + list5[0].KPI_NAME + "</span></th>" +
                    "<th><span >" + list6[0].KPI_NAME + "</span></th>" +
                    "<th><span >" + list7[0].KPI_NAME + "</span></th>" +
                    "<th><span >" + list8[0].KPI_NAME + "</span></th>" +
                    // "<th><span >" + list9[0].KPI_NAME + "</span></th>" +
                    "</tr>";

                if (DATE_TYPE == "showYear") {
                    var UnitIdList = new Array()   //结果ID列表
                    var succList2 = new Array();
                    var countList2 = new Array();
                    var AvgList2 = new Array() //结果VALUE列表
                    var AvgList3 = new Array();
                    var AvgList4 = new Array();
                    var AvgList5 = new Array();
                    var AvgList6 = new Array();
                    var AvgList7 = new Array();
                    var AvgList8 = new Array();
                    // var AvgList9 = new Array();

                    var map = new Map()            //结果map
                    var iSameLine = 0 //相同条数标志位
                    var SumValue2 = 0 //和值
                    var SumValue3 = 0;
                    var SumValue4 = 0;
                    var SumValue5 = 0;
                    var SumValue6 = 0;
                    var SumValue7 = 0;
                    var SumValue8 = 0;
                    // var SumValue9 = 0;

                    var gsuccValue = 0
                    var gcountValue = 0
                    var sTreeUnitId   //上一次ID

                    var str           //原始unit_id
                    var sUnitId       //名称
                    var succValue
                    var countValue
                    var AvgValue2
                    var AvgValue3
                    var AvgValue4
                    var AvgValue5
                    var AvgValue6
                    var AvgValue7
                    var AvgValue8
                    // var AvgValue9

                    for (i = 1; i < list1.length; i++) {
                        str = list1[i].UNIT_ID;
                        sUnitId = str.split("-")[4];
                        succValue = parseInt(list1[i].SUCCESS_VALUE);
                        countValue = parseInt(list1[i].COUNT_VALUE);
                        AvgValue2 = parseInt(list2[i].AVG_VALUE)  //获取对应的avg_value/
                        AvgValue3 = parseInt(list3[i].AVG_VALUE);
                        AvgValue4 = parseInt(list4[i].AVG_VALUE);
                        AvgValue5 = parseInt(list5[i].AVG_VALUE);
                        AvgValue6 = parseInt(list6[i].AVG_VALUE);
                        AvgValue7 = parseInt(list7[i].AVG_VALUE);
                        AvgValue8 = parseInt(list8[i].AVG_VALUE);

                        if (i == 0) {                    //第一次进入标志位强制相同
                            sTreeUnitId = sUnitId;
                        }
                        if (sTreeUnitId == sUnitId) {   //本次循环获取id与上次相同累加并继续下次循环
                            gsuccValue = gsuccValue + succValue;
                            gcountValue = gcountValue + countValue;
                            SumValue2 = SumValue2 + AvgValue2;
                            SumValue3 = SumValue3 + AvgValue3;
                            SumValue4 = SumValue4 + AvgValue4;
                            SumValue5 = SumValue5 + AvgValue5;
                            SumValue6 = SumValue6 + AvgValue6;
                            SumValue7 = SumValue7 + AvgValue7;
                            SumValue8 = SumValue8 + AvgValue8;
                            // SumValue9 = SumValue9 + AvgValue9;

                            iSameLine = iSameLine + 1     //桩相同条数
                            // console.log('桩相同条数' + iSameLine)
                            // console.log('------------------' + i + 1)
                            if (i == list1.length - 1) {   //循环到最后一次如果与上一次相同直接写出结果
                                UnitIdList.push(sTreeUnitId);
                                succList2.push(gsuccValue);
                                countList2.push(gcountValue);
                                AvgList2.push(SumValue2);
                                AvgList3.push(SumValue3);
                                AvgList4.push(SumValue4);
                                AvgList5.push(SumValue5);
                                AvgList6.push(SumValue6);
                                AvgList7.push(SumValue7);
                                AvgList8.push(SumValue8);
                                // AvgList9.push(SumValue9);

                                map.set(sTreeUnitId, SumValue2)
                            }
                        } else {
                            UnitIdList.push(sTreeUnitId);
                            succList2.push(gsuccValue);
                            countList2.push(gcountValue);
                            AvgList2.push(SumValue2);
                            AvgList3.push(SumValue3);
                            AvgList4.push(SumValue4);
                            AvgList5.push(SumValue5);
                            AvgList6.push(SumValue6);
                            AvgList7.push(SumValue7);
                            AvgList8.push(SumValue8);
                            // AvgList9.push(SumValue9);

                            map.set(sTreeUnitId, SumValue2);
                            iSameLine = 1
                            sTreeUnitId = sUnitId
                            gsuccValue = succValue;
                            gcountValue = countValue;
                            SumValue2 = AvgValue2
                            SumValue3 = AvgValue3;
                            SumValue4 = AvgValue4;
                            SumValue5 = AvgValue5;
                            SumValue6 = AvgValue6;
                            SumValue7 = AvgValue7;
                            SumValue8 = AvgValue8;
                            // SumValue9 = AvgValue9;
                        }
                    }

                    for (var c = 1; c < UnitIdList.length; c++) {
                        table += "<tr>" +
                            "<td><span >" + UnitIdList[c] + "</span></td>" +
                            "<td><span >" + succList2[c] / countList2[c] * 100 / iSameLine + "%" + "</span></td>" +
                            "<td><span >" + AvgList2[c] / iSameLine + "</span></td>" +
                            "<td><span >" + AvgList3[c] / iSameLine + "</span></td>" +
                            "<td><span >" + AvgList4[c] / iSameLine + "</span></td>" +
                            "<td><span >" + AvgList5[c] / iSameLine + "</span></td>" +
                            "<td><span >" + AvgList6[c] / iSameLine + "</span></td>" +
                            "<td><span >" + AvgList7[c] / iSameLine + "</span></td>" +
                            "<td><span >" + AvgList8[c] / iSameLine + "</span></td>" +
                            // "<td><span >" + AvgList9[c] / iSameLine + "</span></td>" +
                            "</tr>";
                    }
                    $("#row6").css("height", UnitIdList.length * 34 + 14 + 34 + 34);

                } else {
                    for (var i = 1; i < list1.length; i++) {
                        var str = list1[i].UNIT_ID;
                        var PORTNAME = str.split("-")[4];
                        table += "<tr>" +
                            "<td><span >" + PORTNAME + "</span></td>" +
                            "<td><span >" + parseInt((list1[i].SUCCESS_VALUE / list1[i].COUNT_VALUE) * 100) + "%" + "</span></td>" +
                            "<td><span >" + list2[i].AVG_VALUE + "</span></td>" +
                            "<td><span >" + list3[i].AVG_VALUE + "</span></td>" +
                            "<td><span >" + list4[i].AVG_VALUE + "</span></td>" +
                            "<td><span >" + list5[i].AVG_VALUE + "</span></td>" +
                            "<td><span >" + list6[i].AVG_VALUE + "</span></td>" +
                            "<td><span >" + list7[i].AVG_VALUE + "</span></td>" +
                            "<td><span >" + list8[i].AVG_VALUE + "</span></td>" +
                            // "<td><span >" + list9[i].AVG_VALUE + "</span></td>" +
                            "</tr>";
                    }
                    $("#row6").css("height", list1.length * 34 + 14 + 34 + 34);
                }
            }
            $("#pool").append(table);
        }, error: function (textStatus) {
            console.log("error:" + textStatus.status);
        }
    });
}

//接口信息
// function ifConfig(DATE_TYPE) {
//     var str = jkList.toString();
//     $.ajax({
//         url: ctx + "/load/queryTable",
//         type: "post",
//         data: "EXT_UNIT_ID=" + EXT_UNIT_ID + "&RESU=" + str + "&DATE_TYPE=" + DATE_TYPE,
//         success: function (data) {
//             var map = JSON.parse(data);
//             var list = map["PM-00-01-900-01"];
//             var list1 = map["PM-00-02-001-05"];
//             var list2 = map["PM-00-04-099-05"];
//             var tablel = "";
//             var tabler = "";
//             if (list != null && list.length != 0) {
//                 tablel += "<tr>" +
//                     "<th><span >" + "端口标识" + "</span></th>" +
//                     "<th><span >" + list[0].KPI_NAME + "</span></th>" +
//                     "</tr>";
//                 tabler += "<tr>" +
//                     "<th><span >" + "端口标识" + "</span></th>" +
//                     "<th><span >" + list[0].KPI_NAME + "</span></th>" +
//                     "</tr>";
//             }
//             if (list1 != null && list1.length != 0) {
//                 tablel += "<tr>" +
//                     "<th><span >" + "端口标识" + "</span></th>" +
//                     "<th><span >" + list1[0].KPI_NAME + "</span></th>" +
//                     "</tr>";
//                 tabler += "<tr>" +
//                     "<th><span >" + "端口标识" + "</span></th>" +
//                     "<th><span >" + list1[0].KPI_NAME + "</span></th>" +
//                     "</tr>";
//             }
//             if (list2 != null && list2.length != 0) {
//                 tablel += "<tr>" +
//                     "<th><span >" + "端口标识" + "</span></th>" +
//                     "<th><span >" + list2[0].KPI_NAME + "</span></th>" +
//                     "</tr>";
//                 tabler += "<tr>" +
//                     "<th><span >" + "端口标识" + "</span></th>" +
//                     "<th><span >" + list2[0].KPI_NAME + "</span></th>" +
//                     "</tr>";
//             }
//             if (DATE_TYPE == "showYear") {
//                 var UnitIdList = new Array()   //结果ID列表
//                 var AvgValueList = new Array() //结果VALUE列表
//                 var AvgList1 = new Array();
//                 var succList2 = new Array();
//                 var countList2 = new Array();
//                 var map = new Map()            //结果map
//                 var iSameLine = 0 //相同条数标志位
//                 var iSumValue = 0 //和值
//                 var gSumValue = 0;
//                 var gsuccValue = 0
//                 var gcountValue = 0
//                 var sTreeUnitId   //上一次ID
//
//                 var str           //原始unit_id
//                 var sUnitId       //Unit_id
//                 var iAvgValue     //avg_value
//                 var gAvgValue   //list1的value
//                 var succValue
//                 var countValue
//                 if (list.length == 0) {
//
//                 }
//                 if (list2.length == 0) {
//
//                 }
//                 if (list1.length == 0) {
//
//                 } else {
//                     for (i = 0; i < list.length; i++) {
//                         str = list[i].UNIT_ID;
//                         s = str.split("-");
//                         sUnitId = s[4].replace("_", ".");  //获取一条unit_id
//                         iAvgValue = parseInt(list[i].AVG_VALUE)  //获取对应的avg_value/
//                         gAvgValue = parseInt(list1[i].AVG_VALUE);
//                         succValue = parseInt(list2[i].SUCCESS_VALUE);
//                         countValue = parseInt(list2[i].COUNT_VALUE);
//                         if (i == 0) {                    //第一次进入标志位强制相同
//                             sTreeUnitId = sUnitId
//                         }
//                         if (sTreeUnitId == sUnitId) {   //本次循环获取id与上次相同累加并继续下次循环
//                             iSumValue = iSumValue + iAvgValue
//                             gSumValue = gSumValue + gAvgValue;
//                             gsuccValue = gsuccValue + succValue;
//                             gcountValue = gcountValue + countValue;
//                             iSameLine = iSameLine + 1     //桩相同条数
//                             if (i == list.length - 1) {   //循环到最后一次如果与上一次相同直接写出结果
//                                 UnitIdList.push(sTreeUnitId)
//                                 AvgValueList.push(iSumValue)
//                                 AvgList1.push(gSumValue);
//                                 succList2.push(gsuccValue);
//                                 countList2.push(gcountValue);
//                                 map.set(sTreeUnitId, iSumValue)
//                             }
//                         } else {
//                             UnitIdList.push(sTreeUnitId)
//                             AvgValueList.push(iSumValue)
//                             AvgList1.push(gSumValue);
//                             succList2.push(gsuccValue);
//                             countList2.push(gcountValue);
//                             map.set(sTreeUnitId, iSumValue)
//                             iSameLine = 1
//                             sTreeUnitId = sUnitId
//                             iSumValue = iAvgValue
//                             gSumValue = gAvgValue;
//                             gsuccValue = succValue;
//                             gcountValue = countValue;
//                         }
//
//                     }
//
//                     for (var c = 0; c < UnitIdList.length; c++) {
//                         if (c < UnitIdList.length / 2) {
//                             tablel += "<tr>" +
//                                 "<td><span >" + UnitIdList[c] + "</span></td>" +
//                                 "<td><span >" + AvgValueList[c] / iSameLine + "Mbps" + "</span></td>" +
//                                 "<td><span >" + AvgList1[c] / iSameLine + "%" + "</span></td>" +
//                                 "<td><span >" + succList2[c] / countList2[c] * 100 / iSameLine + "%" + "</span></td>" +
//                                 "</tr>";
//                         } else {
//                             tabler += "<tr>" +
//                                 "<td><span >" + UnitIdList[c] + "</span></td>" +
//                                 "<td><span >" + AvgValueList[c] / iSameLine + "Mbps" + "</span></td>" +
//                                 "<td><span >" + AvgList1[c] / iSameLine + "%" + "</span></td>" +
//                                 "<td><span >" + succList2[c] / countList2[c] * 100 / iSameLine + "%" + "</span></td>" +
//                                 "</tr>";
//                         }
//                     }
//                 }
//                 $("#row7").css("height", UnitIdList.length % 2 * 34 + 14 + 505);
//             } else {
//                 if (list.length == 0) {
//
//                 }
//                 if (list2.length == 0) {
//
//                 }
//                 if (list1.length == 0) {
//
//                 } else {
//                     for (var i = 0; i < list.length; i++) {
//                         var str = list1[i].UNIT_ID;
//                         var s = str.split("-");
//                         var PORTNAME = s[4].replace("_", ".");
//                         if (i < list.length / 2) {
//                             tablel += "<tr>" +
//                                 "<td><span >" + PORTNAME + "</span></td>" +
//                                 "<td><span >" + (list[i].AVG_VALUE) + "Mbps" + "</span></td>" +
//                                 "<td><span >" + (list1[i].AVG_VALUE) + "%" + "</span></td>" +
//                                 "<td><span >" + parseInt((list2[i].SUCCESS_VALUE / list2[i].COUNT_VALUE) * 100) + "%" + "</span></td>" +
//                                 "</tr>";
//                         } else {
//                             tabler += "<tr>" +
//                                 "<td><span >" + PORTNAME + "</span></td>" +
//                                 "<td><span >" + (list[i].AVG_VALUE) + "Mbps" + "</span></td>" +
//                                 "<td><span >" + (list1[i].AVG_VALUE) + "%" + "</span></td>" +
//                                 "<td><span >" + parseInt((list2[i].SUCCESS_VALUE / list2[i].COUNT_VALUE) * 100) + "%" + "</span></td>" +
//                                 "</tr>";
//                         }
//                     }
//                     $("#row7").css("height", list.length % 2 * 34 + 14 + 505);
//                 }
//             }
//             $("#on").append(tablel);
//             $("#off").append(tabler);
//         }, error: function (textStatus) {
//             console.log("error:" + textStatus.status);
//         }
//     });
//
// }

//按钮事件
// $(".rad_1").click(function () {
//     var flag = $(this).attr('for');
//     cpu_echart.clear();
//     memory_echart.clear();
//     snmp_echart.clear();
//     cpu_h.clear();
//     memory_h.clear();
//     put_h.clear();
//     cpu_num.clear();
//     memory_num.clear();
//     put_num.clear();
//     $("#pool tr").remove();
//     // $("#on tr").remove();
//     // $("#off tr").remove();
//     $("#info tr").remove();
//
//
//     queryBasicInfo(flag);
//     queryCpuState(flag);
//     queryMemoryState(flag);
//     querySNMPState(flag);
//     contrastCPU(flag);
//     contrastMemory(flag);
//     contrastPut(flag);
//     queryCPUNum(flag);
//     queryMemoryNum(flag);
//     queryPutNum(flag);
//     queryPoolInfor(flag);
//     // ifConfig(flag);
// });